{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[33mDEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).\u001b[0m\n", "Requirement already satisfied: numpy in /home/megan.owen/.local/lib/python3.4/site-packages (1.16.0)\n" ] } ], "source": [ "# Install the numpy library if needed\n", "!pip install --user numpy" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[33mDEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).\u001b[0m\n", "Requirement already satisfied: scipy in /home/megan.owen/.local/lib/python3.4/site-packages (1.2.1)\n", "Requirement already satisfied: numpy>=1.8.2 in /home/megan.owen/.local/lib/python3.4/site-packages (from scipy) (1.16.0)\n" ] } ], "source": [ "# Install the scipy library if needed\n", "!pip install --user scipy" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "import numpy as np\n", "import scipy.stats as stats\n", "\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Lab 4 - Probability distributions: Normal and Exponential\n", "\n", "Recall that a *probability distribution* is a math function that describes the probabilities of different outcomes. Sometimes, we want to find the probability distribution that describes the distribution of the data (called the *empirical distribution*).\n", "\n", "## Normal or Gaussian distribution\n", "\n", "In MAT 128 we looked at the normal (or Gaussian) distribution, which has the equation: $${\\displaystyle f(x\\mid \\mu ,\\sigma ^{2})={\\frac {1}{\\sqrt {2\\pi \\sigma ^{2}}}}e^{-{\\frac {(x-\\mu )^{2}}{2\\sigma ^{2}}}}}$$\n", "\n", "This distribution is a *parametric distribution* because the function depends on two parameters: the mean $\\mu$ (pronounced \"mu\"), and the standard deviation $\\sigma$ (pronounced \"sigma\").\n", "\n", "Let's plot the normal distribution. First define variables for mu and sigma so we can easily change them." ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": true }, "outputs": [], "source": [ "mu = 0\n", "sigma = 1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To plot graphs in Python, we actually plot a bunch of points very close together, and thus need to generate the x and y values for these points. First we generate 100 evenly spaces x values between mu - 3*sigma = -3 and mu+3*sigma = 3." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([-3. , -2.93939394, -2.87878788, -2.81818182, -2.75757576,\n", " -2.6969697 , -2.63636364, -2.57575758, -2.51515152, -2.45454545,\n", " -2.39393939, -2.33333333, -2.27272727, -2.21212121, -2.15151515,\n", " -2.09090909, -2.03030303, -1.96969697, -1.90909091, -1.84848485,\n", " -1.78787879, -1.72727273, -1.66666667, -1.60606061, -1.54545455,\n", " -1.48484848, -1.42424242, -1.36363636, -1.3030303 , -1.24242424,\n", " -1.18181818, -1.12121212, -1.06060606, -1. , -0.93939394,\n", " -0.87878788, -0.81818182, -0.75757576, -0.6969697 , -0.63636364,\n", " -0.57575758, -0.51515152, -0.45454545, -0.39393939, -0.33333333,\n", " -0.27272727, -0.21212121, -0.15151515, -0.09090909, -0.03030303,\n", " 0.03030303, 0.09090909, 0.15151515, 0.21212121, 0.27272727,\n", " 0.33333333, 0.39393939, 0.45454545, 0.51515152, 0.57575758,\n", " 0.63636364, 0.6969697 , 0.75757576, 0.81818182, 0.87878788,\n", " 0.93939394, 1. , 1.06060606, 1.12121212, 1.18181818,\n", " 1.24242424, 1.3030303 , 1.36363636, 1.42424242, 1.48484848,\n", " 1.54545455, 1.60606061, 1.66666667, 1.72727273, 1.78787879,\n", " 1.84848485, 1.90909091, 1.96969697, 2.03030303, 2.09090909,\n", " 2.15151515, 2.21212121, 2.27272727, 2.33333333, 2.39393939,\n", " 2.45454545, 2.51515152, 2.57575758, 2.63636364, 2.6969697 ,\n", " 2.75757576, 2.81818182, 2.87878788, 2.93939394, 3. ])" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)\n", "x" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "For each x value, we can compute the value of the normal distribution (the y value):" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([0.00443185, 0.00530579, 0.00632878, 0.00752133, 0.00890582,\n", " 0.0105065 , 0.01234943, 0.01446241, 0.01687483, 0.01961746,\n", " 0.02272223, 0.02622189, 0.03014961, 0.03453857, 0.03942137,\n", " 0.0448295 , 0.05079264, 0.05733801, 0.06448952, 0.07226707,\n", " 0.08068571, 0.08975477, 0.09947714, 0.10984842, 0.12085626,\n", " 0.13247967, 0.14468855, 0.15744319, 0.17069405, 0.18438164,\n", " 0.1984366 , 0.21277993, 0.22732351, 0.24197072, 0.2566174 ,\n", " 0.27115285, 0.28546117, 0.29942268, 0.31291556, 0.3258175 ,\n", " 0.33800759, 0.34936814, 0.35978656, 0.36915722, 0.37738323,\n", " 0.38437808, 0.3900672 , 0.39438923, 0.39729716, 0.39875915,\n", " 0.39875915, 0.39729716, 0.39438923, 0.3900672 , 0.38437808,\n", " 0.37738323, 0.36915722, 0.35978656, 0.34936814, 0.33800759,\n", " 0.3258175 , 0.31291556, 0.29942268, 0.28546117, 0.27115285,\n", " 0.2566174 , 0.24197072, 0.22732351, 0.21277993, 0.1984366 ,\n", " 0.18438164, 0.17069405, 0.15744319, 0.14468855, 0.13247967,\n", " 0.12085626, 0.10984842, 0.09947714, 0.08975477, 0.08068571,\n", " 0.07226707, 0.06448952, 0.05733801, 0.05079264, 0.0448295 ,\n", " 0.03942137, 0.03453857, 0.03014961, 0.02622189, 0.02272223,\n", " 0.01961746, 0.01687483, 0.01446241, 0.01234943, 0.0105065 ,\n", " 0.00890582, 0.00752133, 0.00632878, 0.00530579, 0.00443185])" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "y = stats.norm.pdf(x, mu, sigma)\n", "y" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note: pdf standard for *probability density function* which is what a continuous probability distribution is called\n", "\n", "Now make a line plot of these x and y values:" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAD8CAYAAACb4nSYAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl4VeW5/vHvkxlCCFPCkBkSZpkMAUSccMBqwakKFIE6t6L2+OtgT1ttre1ptfXYWtrKccQJUaylikVRUZExDCIEAiEDSRiSECAQMuf5/ZFtGyOYbbKTtYfnc1253HvttcK9L8zNylrvfl9RVYwxxgSGIKcDGGOM6TxW+sYYE0Cs9I0xJoBY6RtjTACx0jfGmABipW+MMQHESt8YYwKIlb4xxgQQK31jjAkgIU4HaKlPnz6anJzsdAxjjPEpmzdvLlPVmNb287rST05OJjMz0+kYxhjjU0SkwJ397PKOMcYEECt9Y4wJIFb6xhgTQKz0jTEmgLhV+iIyTUSyRSRHRO77iv2uFREVkfRm237iOi5bRC7zRGhjjDFt0+roHREJBhYClwBFwCYRWa6qWS32iwLuATY02zYcmAmMAAYAq0RksKo2eO4tGGOMcZc7Z/oZQI6q5qpqLbAEmHGa/X4F/A6obrZtBrBEVWtUNQ/IcX0/Y4wxDnBnnH4cUNjseREwofkOIjIOSFDVt0Tkhy2OXd/i2Lg2ZjWm05VUVLMxv5w9h0+Ca2nR8NBgRsf3YGxiDyLDve6jLsZ8pXb/HysiQcCjwPx2fI/bgNsAEhM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W8t+ms7nuv69DHhRVV93Oo8nqOoxEfkAmAZ4/Ga7T57pfxURSWv2dAaw26ks7SUi04AfAdNV9ZTTeQKYO0uGmk7muvn5FLBLVR91Ok97iEjM56PzRKQLTYMGOqS7/HH0zjJgCE0jRQqAO1TVJ8/KXMtPhtO0yDzAeh8eiXQ18DgQAxwDtqnqZc6mcp+IfAN4jP8sGfprhyO1mYi8DFxA04yOh4EHVPUpR0O1gYicC3wMfEbTzzvAf6vqCudStY2IjAKeo+n/ryBgqao+2CF/lr+VvjHGmDPzu8s7xhhjzsxK3xhjAoiVvjHGBBArfWOMCSBW+sYYE0Cs9I0xJoBY6RtjTACx0jfGmADy/wGERzw5Pjc+ZwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.plot(x,y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Because the x values were so close together, we can't tell that it is made up of a bunch of straight lines.\n", "\n", "In MAT 128 we sampled values from the normal distribution using the numpy library:\n", "We can sample 1000 values from this normal distribution (as done in MAT 128):" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([ 1.24817571, 1.87164031, 1.00263015, -0.45495277, -0.88547923,\n", " 2.68034378, -0.82959907, -0.62358838, 0.38094592, 0.55341618,\n", " -0.40712291, -0.27382871, -0.71553491, -0.47744367, 0.98952602,\n", " 1.05373845, -0.64853685, 1.63910772, -0.71588855, 0.17227553,\n", " 0.2477529 , -0.26161482, 1.41295143, -0.34466729, 1.36922747,\n", " -1.18666627, -2.25321007, -0.48328171, 1.2742343 , -0.39525499,\n", " 0.16772651, -0.44201469, -0.48323019, -1.78079555, 0.05659511,\n", " -1.26776398, -1.36053151, 0.26540573, -0.2429451 , -0.43338263,\n", " -0.45666899, -0.11675243, -0.07714143, 0.54796204])" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sample = np.random.normal(loc = mu, scale = sigma, size = 44)\n", "sample" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot a histogram of the sample. Remember you will first have to make it into a Pandas Series: `pd.Series(sample)` \n", "\n", "How does the histogram compare to the normal probability distribution?" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD8CAYAAABXe05zAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAC/lJREFUeJzt3V+IXOUZx/Hfr0mKkrHxInZaonR7UQQxLZKhf/Bm1/4hNdLS0oJCA6WWvWgVCykSEUp7URqoSi9aKFLFXlgXoUpLotWUOhVBbXdtahKjRSSlCaKIkDoqLVufXmQDcd2ZeTc7Z84+c74fCGR33pzzvDu7X8bZM6MjQgCAPN5X9wAAgNUh3ACQDOEGgGQINwAkQ7gBIBnCDQDJEG4ASIZwA0AyhBsAktlYxUG3bt0aU1NTVRx6oDfffFObN28e+3nrxr6bo4l7lpqx74WFhdci4qKStZWEe2pqSvPz81UceqBut6vp6emxn7du7Ls5mrhnqRn7tv3P0rU8VQIAyRBuAEiGcANAMoQbAJIh3ACQTNFVJbaPS3pD0v8kLUZEp8qhAAD9reZywJmIeK2ySQAARXiqBACSKQ13SHrU9oLt2SoHAgAM5pL/WbDtbRFx0vYHJR2UdGNEPL5szaykWUlqt9s75ubmqph3oF6vp1arNfbz1q3qfR8+eWrkx9y+bcuaj9HE+7uJe5aase+ZmZmF0t8fFoX7Xf/A/qGkXkTc1m9Np9MJXvI+PlXve2rvgZEf8/i+XWs+RhPv7ybuWWrGvm0Xh3voUyW2N9u+4MzfJX1B0pG1jQgAOFclV5W0JT1o+8z630TEHyqdCgDQ19BwR8R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i3p55IukHTQ9iHbv6x7oHGw/RXbJyR9RtIB24/UPVMVln7xfOYtGI5Jur8Jb8Fg+z5JT0q61PYJ29fXPdOYXClpt6Srln6eD9m+uu6h6sYrJwEgmUl8xA0AE41wA0AyhBsAkiHcAJAM4QaAZAg3ACRDuAEgGcINAMn8H+XLQRxjAXcUAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pd.Series(sample).hist(bins = 30)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To really compare the probability distribution with the histogram, we can plot the two in the same plot, using the `density` option to change the y axis of the histogram to the same scale as the probability distribution." ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl4VOX5xvHvk0yCSACVJSKguICKorYEFK2aWBcUBRWtoj8tLYhLERdccKlVqi2u1SpVqVrRqhFrrSAoWmxcaq0sRRAQihRlURFUMGzJzDy/Pya2KQUymWRyZs7cn+vKRc7kzMz9MuRm8uac95i7IyIi4ZIXdAAREWl8KncRkRBSuYuIhJDKXUQkhFTuIiIhpHIXEQkhlbuISAip3EVEQkjlLiISQpGgnrht27bepUuXlO67fv16WrRo0biBAqKxZJ6wjAM0lkzVkLHMnDlztbu3q2u/wMq9S5cuzJgxI6X7VlRUUFpa2riBAqKxZJ6wjAM0lkzVkLGY2cfJ7KdpGRGREFK5i4iEkMpdRCSEVO4iIiGkchcRCSGVu4hICKncRURCSOUuIhJCKncRkRAK7AxVyW1dRk1O+3MsHdMv7c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mfzeyDrXwMAHD3G9y9M/AUMDzYtNtX11hq9rkBiJIYT0ZKZhwijc3MioDngcu3+Kk9q7h7zN0PIfHTeW8zS9uUWUZfrMPdj01y16dIHIf/szTGaZC6xmJmg4GTge9n8tm99XhNslEyS21IE6uZn34eeMrd/xh0nsbg7l+b2V+AvkBafumd0e/ct8fMutbaHAB8GFSWhqq5GMo1QH933xB0nhyWzFIb0oRqfgn5KLDA3e8JOk9DmFm7b4+EM7PmJH5xn7beyuajZZ4H9iVxdMbHwEXunpXvsmqWbWjGfxZbezcbj/wxs9OA+4F2wNfAbHc/IdhU9WNmJwH38p+lNm4LOFJKzOwZoJTE6oOfAz9z90cDDZUCM/se8BYwl8T3OsD1NWfNZxUzOwgYT+LfVh4wwd1Hp+35srXcRURk27J2WkZERLZN5S4iEkIqdxGREFK5i4iEkMpdRCSEVO4iIiGkchcRCSGVu4hICP0/3zQJk4ZgZBoAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pd.Series(sample).hist(density = True)\n", "plt.plot(x,y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Normally distributed data\n", "\n", "Let's look at some normally distributed data. Download the text file `babyboom.dat.txt`. It contains data about 44 babies that were born on December 18, 1997 at the Mater Mothers' Hospital in Brisbane, Australia. \n", "\n", "Data Columns:\n", " - Time of birth recorded on the 24-hour clock\n", " - Sex of the child (1 = girl, 2 = boy)\n", " - Birth weight in grams\n", " - Number of minutes after midnight of each birth\n", "\n", "Data set from: https://raw.githubusercontent.com/cs109/2015lab3/master/babyboom.dat.txt\n", "Original references:\n", "Steele, S. (December 21, 1997), \"Babies by the Dozen for Christmas: 24-Hour Baby Boom,\" The Sunday Mail (Brisbane), p. 7\n", "\n", "Open the dataset in a text editor. How are the columns separated? Are there any columns names?\n", "\n", "Despite these issues we can still use `pd.read_csv()`:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": true }, "outputs": [], "source": [ "babies = pd.read_csv(\"babyboom.dat.txt\", header=None, sep='\\s+', names=['24hrtime','sex','weight','minutes'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The parameter `header=None` tells `read_csv()` that there is no header row with columns names, and instead we specify the column names with the parameter `names=['24hrtime','sex','weight','minutes']`. \n", "\n", "The parameter `sep='\\s+'` tells `read_csv()` that the columns are separated by white space (space, tab, etc.) instead of a comma." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
24hrtimesexweightminutes
05138375
11041333464
21182355478
315523838115
425723625177
540512208245
640711745247
742222846262
843123166271
970823520428
1073523380455
1181223294492
1281412576494
1390913208549
14103523521635
15104913746649
16105313523653
17113322902693
18120922635729
19125623920776
20130523690785
21140613430846
22140713480847
23143313116873
24144613428886
25151423783914
26163123345991
271657230341017
281742121841062
291807233001087
301825123831105
311854234281134
321909241621149
331947236301187
341949234061189
351951234021191
362010135001210
372037237361237
382051233701251
392104221211264
402123231501283
412217138661337
422327135421407
432355132781435
\n", "
" ], "text/plain": [ " 24hrtime sex weight minutes\n", "0 5 1 3837 5\n", "1 104 1 3334 64\n", "2 118 2 3554 78\n", "3 155 2 3838 115\n", "4 257 2 3625 177\n", "5 405 1 2208 245\n", "6 407 1 1745 247\n", "7 422 2 2846 262\n", "8 431 2 3166 271\n", "9 708 2 3520 428\n", "10 735 2 3380 455\n", "11 812 2 3294 492\n", "12 814 1 2576 494\n", "13 909 1 3208 549\n", "14 1035 2 3521 635\n", "15 1049 1 3746 649\n", "16 1053 1 3523 653\n", "17 1133 2 2902 693\n", "18 1209 2 2635 729\n", "19 1256 2 3920 776\n", "20 1305 2 3690 785\n", "21 1406 1 3430 846\n", "22 1407 1 3480 847\n", "23 1433 1 3116 873\n", "24 1446 1 3428 886\n", "25 1514 2 3783 914\n", "26 1631 2 3345 991\n", "27 1657 2 3034 1017\n", "28 1742 1 2184 1062\n", "29 1807 2 3300 1087\n", "30 1825 1 2383 1105\n", "31 1854 2 3428 1134\n", "32 1909 2 4162 1149\n", "33 1947 2 3630 1187\n", "34 1949 2 3406 1189\n", "35 1951 2 3402 1191\n", "36 2010 1 3500 1210\n", "37 2037 2 3736 1237\n", "38 2051 2 3370 1251\n", "39 2104 2 2121 1264\n", "40 2123 2 3150 1283\n", "41 2217 1 3866 1337\n", "42 2327 1 3542 1407\n", "43 2355 1 3278 1435" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "babies" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Which column might be normally distributed?\n", "\n", "Let's plot a histogram of the weights:" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAED1JREFUeJzt3X+MZXdZx/H3Y1vawuC2peSm2RKnGFLTdLHQK4IYvUP5sbSNRdPEkootYCaRoFWX4DZEwT+IVVMEo5GstLYKMkipoWlBWGlHYgKLs6V02i6lW6jStWxF6MLUBlx5/OOehWHc2Zm5P+bMPvN+JZM959zvPed55tz57Lnn3ntuZCaSpOPfj7RdgC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QmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "babies[\"weight\"].hist()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To compare to a normal distribution, we should compute the mean and standard deviation of the weights:" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3275.9545454545455" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mu_weights = babies[\"weight\"].mean()\n", "mu_weights" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "528.0324582405921" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sigma_weights = babies[\"weight\"].std()\n", "sigma_weights" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Can you plot the normal distribution with this mean and standard deviation on top of your histogram? Remember to change the y axis to `density`." ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAD8CAYAAAC2PJlnAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl8FPX9x/HXJ6eiiHIYEVAQ8ADxRLRaNfUooBWs9UCtRUXRitUq1mJt1VrpT7TWo/VCpaV4ACpqFBQPjNoqCF4oIBgBBURR7qCQbPbz+2OGsqY5ls0xu8n7+Xjkkdnvznz3PcOyn8zMznfM3REREUlFVtQBREQkc6mIiIhIylREREQkZSoiIiKSMhURERFJmYqIiIikTEVERERSpiIiIiIpUxEREZGU5UQdoD60bdvWO3fuHHWMrbJhwwa22267qGOkTPmjpfzRair533nnnW/cvV1d+moSRaRz587MmjUr6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CqdbR5i/fcL0FQTHqyG4R0ziCdCFBCfVc8LpLmw5sd6zEfK3A3YMp7cF3gB+AjzO90/sXhJOD+P7J3Yn1rReEeZvn/Dvcwdwczq+fyqtSyFbTkxnxPavIX9GbH9gO6BlwvSbBOcyGvzzp9H+YZr6D/BDgl3F2cD74c8JBMd5XwE+AV7e/A8S/uPdTXDc/kOgd0Jf5xOcUCwBzos4/7gw32yCsdASi8q1Yf75QP+E9hMIvt31KXBtI+Xfj2CYnNnAR8B1YfseBOO1lYQfaPlh+zbh45Lw+T1qW6+I8k8Lt/9HwMNs+QZXWr1/Kq1LIVs+hDNi+9eQPyO2f7idPwh/5mz+f0cjfP7oinUREUmZzomIiEjKVERERCRlKiIiIpIyFREREUmZioiIiKRMRURERFKmIiIiIilTERERkZT9PzmjnH7tA3EEAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "babies[\"weight\"].hist(density = True)\n", "x = np.linspace(mu_weights - 3*sigma_weights, mu_weights + 3*sigma_weights, 100)\n", "y = stats.norm.pdf(x,mu_weights,sigma_weights)\n", "plt.plot(x,y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Do you think the weights are normally distributed?\n", "\n", "## Exponential distribution\n", "\n", "Let's look at one more distribution. The exponential distribution is used to model the time between events that happen independently. Here, we will use it to model the time between the babies' births.\n", "\n", "The function for the exponential distribution is: $$\n", "f(x;\\lambda) = \\begin{cases}\n", "\\lambda e^{-\\lambda x} \\quad \\text{if } x \\ge 0, \\\\\n", "0 \\quad \\quad \\text{if } x < 0.\n", "\\end{cases}\n", "$$\n", "\n", "The exponential distribution is also a parametric distribution. How many parameters does it have and what are they?\n", "\n", "$\\lambda$ (\"lambda\") is called the *rate parameter*, and is estimated as $\\frac{1}{\\text{mean of data}}$. \n", "\n", "\n", "Let's plot the explonential function. First create a set of `x` values between -2 and 5." ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([-2. , -1.92929293, -1.85858586, -1.78787879, -1.71717172,\n", " -1.64646465, -1.57575758, -1.50505051, -1.43434343, -1.36363636,\n", " -1.29292929, -1.22222222, -1.15151515, -1.08080808, -1.01010101,\n", " -0.93939394, -0.86868687, -0.7979798 , -0.72727273, -0.65656566,\n", " -0.58585859, -0.51515152, -0.44444444, -0.37373737, -0.3030303 ,\n", " -0.23232323, -0.16161616, -0.09090909, -0.02020202, 0.05050505,\n", " 0.12121212, 0.19191919, 0.26262626, 0.33333333, 0.4040404 ,\n", " 0.47474747, 0.54545455, 0.61616162, 0.68686869, 0.75757576,\n", " 0.82828283, 0.8989899 , 0.96969697, 1.04040404, 1.11111111,\n", " 1.18181818, 1.25252525, 1.32323232, 1.39393939, 1.46464646,\n", " 1.53535354, 1.60606061, 1.67676768, 1.74747475, 1.81818182,\n", " 1.88888889, 1.95959596, 2.03030303, 2.1010101 , 2.17171717,\n", " 2.24242424, 2.31313131, 2.38383838, 2.45454545, 2.52525253,\n", " 2.5959596 , 2.66666667, 2.73737374, 2.80808081, 2.87878788,\n", " 2.94949495, 3.02020202, 3.09090909, 3.16161616, 3.23232323,\n", " 3.3030303 , 3.37373737, 3.44444444, 3.51515152, 3.58585859,\n", " 3.65656566, 3.72727273, 3.7979798 , 3.86868687, 3.93939394,\n", " 4.01010101, 4.08080808, 4.15151515, 4.22222222, 4.29292929,\n", " 4.36363636, 4.43434343, 4.50505051, 4.57575758, 4.64646465,\n", " 4.71717172, 4.78787879, 4.85858586, 4.92929293, 5. ])" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "x = np.linspace(-2, 5, 100)\n", "x\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next calculate the `y` values when lambda is 1. Note that since `lambda` is a reserved word in Python, we can't use it as our variable name and will use `lambda_` instead." ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([0. , 0. , 0. , 0. , 0. ,\n", " 0. , 0. , 0. , 0. , 0. ,\n", " 0. , 0. , 0. , 0. , 0. ,\n", " 0. , 0. , 0. , 0. , 0. ,\n", " 0. , 0. , 0. , 0. , 0. ,\n", " 0. , 0. , 0. , 0. , 0.95074913,\n", " 0.88584603, 0.82537356, 0.76902926, 0.71653131, 0.66761715,\n", " 0.62204212, 0.57957828, 0.54001324, 0.50314912, 0.46880154,\n", " 0.4367987 , 0.40698054, 0.37919793, 0.3533119 , 0.32919299,\n", " 0.30672056, 0.28578221, 0.26627323, 0.24809603, 0.2311597 ,\n", " 0.21537953, 0.2006766 , 0.18697737, 0.17421332, 0.16232061,\n", " 0.15123976, 0.14091534, 0.13129573, 0.1223328 , 0.11398172,\n", " 0.10620074, 0.09895092, 0.09219601, 0.08590223, 0.0800381 ,\n", " 0.07457428, 0.06948345, 0.06474015, 0.06032065, 0.05620285,\n", " 0.05236615, 0.04879136, 0.04546061, 0.04235723, 0.0394657 ,\n", " 0.03677157, 0.03426135, 0.03192249, 0.0297433 , 0.02771286,\n", " 0.02582104, 0.02405836, 0.02241601, 0.02088578, 0.01946001,\n", " 0.01813156, 0.01689381, 0.01574055, 0.01466602, 0.01366484,\n", " 0.01273201, 0.01186285, 0.01105303, 0.01029849, 0.00959547,\n", " 0.00894043, 0.00833011, 0.00776145, 0.00723161, 0.00673795])" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lambda_ = 1\n", "y = stats.expon.pdf(x, scale = 1/lambda_)\n", "y" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot the x and y values:" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD9CAYAAABHnDf0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2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display_data" } ], "source": [ "plt.plot(x,y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Sampling from the Exponential Distribution\n", "\n", "Sample 1000 values from the exponential distribution with $\\lambda = 1$, using the command:" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": true }, "outputs": [], "source": [ "sample = np.random.exponential(scale = 1/lambda_, size = 1000)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot a histogram of the sample to see its distribution: " ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAERBJREFUeJzt3W+sZHV9x/H3p2Kt5VrAYG+2C+n6gJogm6LcoI2NuVuiohjRpCEQqqA26wM0Gknq6hNtDMk+KNqIrckqVoyrt9Q/gQBaKWVreYDKUuryR+tW17Ab3K0FgatEs/jtg3uwV9zdmTszZ+fOz/crmdwzvznnzGd2N585+5sz56aqkCS167emHUCS1C+LXpIaZ9FLUuMseklqnEUvSY2z6CWpcRa9JDXOopekxln0ktS4E6YdAODUU0+tTZs2jbTtT37yE0488cTJBuqRefs1a3lh9jKbt19rybt79+4fVdXzBq5YVVO/nXPOOTWq22+/feRtp8G8/Zq1vFWzl9m8/VpLXuCuGqJjnbqRpMZZ9JLUOItekhpn0UtS4yx6SWqcRS9JjbPoJalxFr0kNc6il6TGrYtLIIxjz4FHuXzbzSNvv2/7BRNMI0nrj0f0ktQ4i16SGmfRS1LjLHpJapxFL0mNs+glqXEWvSQ1zqKXpMZZ9JLUOItekhpn0UtS4yx6SWrcwKJPcnqS25Pcn+S+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ZyT5jyQ3TTvLIEn2JdmT5J4kd007zyBJTk7y+STfTvJAkj+ZdqajSfKC7s/1qdtjSd41sf3P6tRNd5mF/2LVZRaAS9brZRaSvBxYBj5dVWdNO88gSTYAG6rq7iTPAXYDr1/Hf74BTqyq5STPBO4A3llVd0452jEleTewAPxeVb122nmOJck+YKGqZuKc9CTXAf9eVZ/ozv773ar68bRzDdJ12wFWvnv0g0nsc5aP6H95mYWq+jnw1GUW1qWq+hrw8LRzDKuqHqqqu7vlx4EHWPnG87pUK5a7u8/sbuv6KCbJacAFwCemnaU1SU4CXg5cC1BVP5+Fku+cB/z3pEoeZrvoj3SZhXVbRLMsySbgRcDXp5vk2LppkHuAQ8CtVbWu8wJ/C/wV8ItpBxlSAV9Nsrv7Zvt69nzgf4B/6KbGPpHkxGmHGtLFwOcmucNZLnodB0nmgC8A76qqx6ad51iq6smqOpuVb2Kfm2TdTpEleS1wqKp2TzvLGvxpVb0YeDVwRTcduV6dALwY+FhVvQj4CbCuP8cD6KaYXgf80yT3O8tFP/AyCxpPN9f9BWBnVX1x2nmG1f0X/Xbg/GlnOYaXAa/r5r2XgD9L8pnpRjq2qjrQ/TwEfImV6dP1aj+wf9X/6j7PSvGvd68G7q6qg5Pc6SwXvZdZ6FH34ea1wANV9aFp5xkkyfOSnNwtP5uVD+m/Pd1UR1dV762q06pqEyv/dv+1qv5iyrGOKsmJ3YfydFMgrwTW7RlkVfVD4MEkL+iGzmM2LpN+CROetoEZ/lWCs3aZhSSfAxaBU5PsB95fVddON9UxvQx4I7Cnm/cGeF/3jef1aANwXXfGwm8B11fVuj9lcYbMA19aef/nBOCzVfWV6UYa6B3Azu5A8HvAm6ec55i6N9BXAG+b+L5n9fRKSdJwZnnqRpI0BItekhpn0UtS4yx6SWqcRS9JjbPoJalxFr0kNc6il6TG/R9gZvXIxCBnLwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pd.Series(sample).hist(bins = 20)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "How does the histogram compare to the theoretical distribution (the probability density function or pdf)?\n", "\n", "### Exponentially distributed data\n", "\n", "The time between births might be exponentially distributed, but we just have the number of minutes after midnight each baby was born. So we need to calculate the difference between the birth times. Luckily this type of calculation is done frequently in data science and there is already a function for it." ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0 NaN\n", "1 59.0\n", "2 14.0\n", "3 37.0\n", "4 62.0\n", "5 68.0\n", "6 2.0\n", "7 15.0\n", "8 9.0\n", "9 157.0\n", "10 27.0\n", "11 37.0\n", "12 2.0\n", "13 55.0\n", "14 86.0\n", "15 14.0\n", "16 4.0\n", "17 40.0\n", "18 36.0\n", "19 47.0\n", "20 9.0\n", "21 61.0\n", "22 1.0\n", "23 26.0\n", "24 13.0\n", "25 28.0\n", "26 77.0\n", "27 26.0\n", "28 45.0\n", "29 25.0\n", "30 18.0\n", "31 29.0\n", "32 15.0\n", "33 38.0\n", "34 2.0\n", "35 2.0\n", "36 19.0\n", "37 27.0\n", "38 14.0\n", "39 13.0\n", "40 19.0\n", "41 54.0\n", "42 70.0\n", "43 28.0\n", "Name: minutes, dtype: float64" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mins_btw_births = babies[\"minutes\"].diff()\n", "mins_btw_births" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot a histogram of the number of minutes between births." ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD8CAYAAABn919SAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAEa9JRE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aWqB9RQRz6Jd5jdk5s3V6qMRsbW6fytwbJ1jvRx4XUQcpj3j5bnAe4DNEbH4OYNhjt0jwCOZeUe1fBPtgh/2uAGcD3wzMx/PzB8CN9Mez1EZO1h9nEbi+RERu4CLgMuqXzgw/Gy/SPuX9N3V82I7cGdEvGAEskH7OXFztn2F9l/WW/qRbZQLfaSmFqh+g34AOJSZ715y1y3A5dXty2lfW183mXl1Zm7PzHHaY/SFzLwM2A+8fli5luR7DPhWRJxRrToPuI8hj1vlYeDsiDip+v4uZhuJsausNk63AL9fvWvjbOD4kksz6yIidtK+1Pe6zPz+krtuAS6JiGdHxOnAi4CvrFeuzJzLzOdn5nj1vHiE9hsaHmMExg34JO0XRomIF9N+o8AT9GPcBvliQB9eTLiA9rtJvg5cM+Qsv0H7z917gLuqrwtoX6++DXiQ9ivXpw4xY4sfv8vlhdUPw0PAx6heUR9Srl8BZqux+yRwyqiMG/DXwP3AQeBfaL/DYChjB9xI+1r+D2mX0BWrjRPtF77fWz035oDmELI9RPua7+Lz4X1Ltr+myvYA8Nr1zrbs/sP8+EXRURi3E4GPVD9zdwLn9mvc/KSoJBVilC+5SJK6YKFLUiEsdEkqhIUuSYWw0CWpEBa6JBXCQpekQljoklSI/wMaVIAHROVFRQAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "mins_btw_births.hist()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Do you think the minutes between births has an exponential distribution? Let's plot the pdf for the exponential function on top of the histogram to compare. \n", "\n", "First, estimate $\\lambda$ by computing $\\frac{1}{\\text{mean time between births}}$:" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.03006993006993007" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "est_lambda = 1/mins_btw_births.mean()\n", "est_lambda" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next plot the pdf of the exponential function with that $\\lambda$ on top of your histogram (using the `density = True` parameter):" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[]" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYQAAAD8CAYAAAB3u9PLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAIABJREFUeJzt3Xl8VPW9//HXZ2YyAUR2jGwS3EWpWlJwqw1aFauV2sJPLHXptaW3ldtF24p6q9allS5uVdviVtciWhdULNeFaNWKiKKIiA2LGlyDCIYlyUw+vz/OQcaQkEnIzMnyfj4e5zHnfM/3nHnPCcmHs8w55u6IiIjEog4gIiJtgwqCiIgAKggiIhJSQRAREUAFQUREQioIIiICqCCIiEhIBUFERAAVBBERCSWiDtAc/fr18+Li4hYtu379enbYYYfWDdQKlKt5lKt5lKt5OmquBQsWVLp7/yY7unu7GUaOHOktNXfu3BYvm0vK1TzK1TzK1TwdNRfwomfxN1aHjEREBNA5BBERCakgiIgIoIIgIiIhFQQREQFUEEREJJRVQTCzsWa21MzKzWxqA/MLzezucP48MysO20eZ2cJweMXMTsx2nSIikl9NFgQziwPXAccCw4GTzWx4vW5nAGvcfXfgSmBa2P4aUOLuBwBjgb+aWSLLdbaedC0FNetytnoRkY4gmz2EUUC5uy939xpgBjCuXp9xwK3h+L3AkWZm7r7B3VNhexdg8wOcs1ln63CH60az27KbcrJ6EZGOIptbVwwC3smYrgBGN9bH3VNmthboC1Sa2WjgZmAocEo4P5t1AmBmk4HJAEVFRZSVlWUR+fP2LhhKn8rneerJx/FY27pbR1VVVYs+U64pV/MoV/MoV/PkK1fO/zq6+zxgXzPbB7jVzB5t5vLTgekAJSUlXlpa2vwQRVVw95N8pTgBu7Zg+RwqKyujRZ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1z15q9ky0nlqLdXErgj/Hf2EnBErreXvqksIiJAxz9kJCIiWVJBEBERQAVBRERCKggiIgKoIIiISEgFQUREABUEEREJqSCIiAgA/x8GrALnQsWkyQAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "mins_btw_births.hist(density = True)\n", "x = np.linspace(0,160,100)\n", "y = stats.expon.pdf(x,scale = 1/est_lambda)\n", "plt.plot(x,y)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Do you think the time between baby births follows an exponential distribution?\n", "\n", "The `scale` parameter is $1/\\lambda$ but since $\\lambda = \\frac{1}{\\text{mean time between births}}$ we could have just used the mean time between births as the scale." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Challenges:\n", "- What happens if you plot the normal distribution only using 10 evenly spaces x values?\n", "- You can also sample from the normal distribution using the scipy library: `sample = stats.norm.rvs(loc=mu, scale=sigma, size=1000)`. Try it.\n", "- Consider the green taxi trip dataset: " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.3" } }, "nbformat": 4, "nbformat_minor": 2 }